using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Impact.Model.Objects
{
	/// <summary>
	/// Strongly-typed collection for the ImpactPage class.
	/// </summary>
    [Serializable]
	public partial class ImpactPageCollection : ActiveList<ImpactPage, ImpactPageCollection>
	{	   
		public ImpactPageCollection() {}
	}
	/// <summary>
	/// This is an ActiveRecord class which wraps the impact_Pages table.
	/// </summary>
	[Serializable]
	public partial class ImpactPage : ActiveRecord<ImpactPage>, IActiveRecord
	{
		#region .ctors and Default Settings
		
		public ImpactPage()
		{
		  SetSQLProps();
		  InitSetDefaults();
		  MarkNew();
		}
		
		private void InitSetDefaults() { SetDefaults(); }
		
		public ImpactPage(bool useDatabaseDefaults)
		{
			SetSQLProps();
			if(useDatabaseDefaults)
				ForceDefaults();
			MarkNew();
		}
        
		public ImpactPage(object keyID)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByKey(keyID);
		}
		 
		public ImpactPage(string columnName, object columnValue)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByParam(columnName,columnValue);
		}
		
		protected static void SetSQLProps() { GetTableSchema(); }
		
		#endregion
		
		#region Schema and Query Accessor	
		public static Query CreateQuery() { return new Query(Schema); }
		public static TableSchema.Table Schema
		{
			get
			{
				if (BaseSchema == null)
					SetSQLProps();
				return BaseSchema;
			}
		}
		
		private static void GetTableSchema() 
		{
			if(!IsSchemaInitialized)
			{
				//Schema declaration
				TableSchema.Table schema = new TableSchema.Table("impact_Pages", TableType.Table, DataService.GetInstance("ImpactProvider"));
				schema.Columns = new TableSchema.TableColumnCollection();
				schema.SchemaName = @"dbo";
				//columns
				
				TableSchema.TableColumn colvarPageId = new TableSchema.TableColumn(schema);
				colvarPageId.ColumnName = "PageId";
				colvarPageId.DataType = DbType.Int32;
				colvarPageId.MaxLength = 0;
				colvarPageId.AutoIncrement = true;
				colvarPageId.IsNullable = false;
				colvarPageId.IsPrimaryKey = true;
				colvarPageId.IsForeignKey = false;
				colvarPageId.IsReadOnly = false;
				colvarPageId.DefaultSetting = @"";
				colvarPageId.ForeignKeyTableName = "";
				schema.Columns.Add(colvarPageId);
				
				TableSchema.TableColumn colvarType = new TableSchema.TableColumn(schema);
				colvarType.ColumnName = "Type";
				colvarType.DataType = DbType.Int32;
				colvarType.MaxLength = 0;
				colvarType.AutoIncrement = false;
				colvarType.IsNullable = false;
				colvarType.IsPrimaryKey = false;
				colvarType.IsForeignKey = true;
				colvarType.IsReadOnly = false;
				
						colvarType.DefaultSetting = @"((1))";
				
					colvarType.ForeignKeyTableName = "impact_PageTypes";
				schema.Columns.Add(colvarType);
				
				TableSchema.TableColumn colvarPageKey = new TableSchema.TableColumn(schema);
				colvarPageKey.ColumnName = "PageKey";
				colvarPageKey.DataType = DbType.AnsiString;
				colvarPageKey.MaxLength = 50;
				colvarPageKey.AutoIncrement = false;
				colvarPageKey.IsNullable = false;
				colvarPageKey.IsPrimaryKey = false;
				colvarPageKey.IsForeignKey = false;
				colvarPageKey.IsReadOnly = false;
				colvarPageKey.DefaultSetting = @"";
				colvarPageKey.ForeignKeyTableName = "";
				schema.Columns.Add(colvarPageKey);
				
				TableSchema.TableColumn colvarCaption = new TableSchema.TableColumn(schema);
				colvarCaption.ColumnName = "Caption";
				colvarCaption.DataType = DbType.AnsiString;
				colvarCaption.MaxLength = 50;
				colvarCaption.AutoIncrement = false;
				colvarCaption.IsNullable = false;
				colvarCaption.IsPrimaryKey = false;
				colvarCaption.IsForeignKey = false;
				colvarCaption.IsReadOnly = false;
				colvarCaption.DefaultSetting = @"";
				colvarCaption.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCaption);
				
				TableSchema.TableColumn colvarParentPageId = new TableSchema.TableColumn(schema);
				colvarParentPageId.ColumnName = "ParentPageId";
				colvarParentPageId.DataType = DbType.Int32;
				colvarParentPageId.MaxLength = 0;
				colvarParentPageId.AutoIncrement = false;
				colvarParentPageId.IsNullable = true;
				colvarParentPageId.IsPrimaryKey = false;
				colvarParentPageId.IsForeignKey = false;
				colvarParentPageId.IsReadOnly = false;
				colvarParentPageId.DefaultSetting = @"";
				colvarParentPageId.ForeignKeyTableName = "";
				schema.Columns.Add(colvarParentPageId);
				
				TableSchema.TableColumn colvarTemplateId = new TableSchema.TableColumn(schema);
				colvarTemplateId.ColumnName = "TemplateId";
				colvarTemplateId.DataType = DbType.Int32;
				colvarTemplateId.MaxLength = 0;
				colvarTemplateId.AutoIncrement = false;
				colvarTemplateId.IsNullable = true;
				colvarTemplateId.IsPrimaryKey = false;
				colvarTemplateId.IsForeignKey = true;
				colvarTemplateId.IsReadOnly = false;
				colvarTemplateId.DefaultSetting = @"";
				
					colvarTemplateId.ForeignKeyTableName = "impact_Templates";
				schema.Columns.Add(colvarTemplateId);
				
				TableSchema.TableColumn colvarTitle = new TableSchema.TableColumn(schema);
				colvarTitle.ColumnName = "Title";
				colvarTitle.DataType = DbType.AnsiString;
				colvarTitle.MaxLength = 255;
				colvarTitle.AutoIncrement = false;
				colvarTitle.IsNullable = true;
				colvarTitle.IsPrimaryKey = false;
				colvarTitle.IsForeignKey = false;
				colvarTitle.IsReadOnly = false;
				colvarTitle.DefaultSetting = @"";
				colvarTitle.ForeignKeyTableName = "";
				schema.Columns.Add(colvarTitle);
				
				TableSchema.TableColumn colvarBody = new TableSchema.TableColumn(schema);
				colvarBody.ColumnName = "Body";
				colvarBody.DataType = DbType.AnsiString;
				colvarBody.MaxLength = 2147483647;
				colvarBody.AutoIncrement = false;
				colvarBody.IsNullable = true;
				colvarBody.IsPrimaryKey = false;
				colvarBody.IsForeignKey = false;
				colvarBody.IsReadOnly = false;
				colvarBody.DefaultSetting = @"";
				colvarBody.ForeignKeyTableName = "";
				schema.Columns.Add(colvarBody);
				
				TableSchema.TableColumn colvarFooterText = new TableSchema.TableColumn(schema);
				colvarFooterText.ColumnName = "FooterText";
				colvarFooterText.DataType = DbType.AnsiString;
				colvarFooterText.MaxLength = 2147483647;
				colvarFooterText.AutoIncrement = false;
				colvarFooterText.IsNullable = true;
				colvarFooterText.IsPrimaryKey = false;
				colvarFooterText.IsForeignKey = false;
				colvarFooterText.IsReadOnly = false;
				colvarFooterText.DefaultSetting = @"";
				colvarFooterText.ForeignKeyTableName = "";
				schema.Columns.Add(colvarFooterText);
				
				TableSchema.TableColumn colvarSequence = new TableSchema.TableColumn(schema);
				colvarSequence.ColumnName = "Sequence";
				colvarSequence.DataType = DbType.Int32;
				colvarSequence.MaxLength = 0;
				colvarSequence.AutoIncrement = false;
				colvarSequence.IsNullable = false;
				colvarSequence.IsPrimaryKey = false;
				colvarSequence.IsForeignKey = false;
				colvarSequence.IsReadOnly = false;
				
						colvarSequence.DefaultSetting = @"((9999))";
				colvarSequence.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSequence);
				
				TableSchema.TableColumn colvarEnabled = new TableSchema.TableColumn(schema);
				colvarEnabled.ColumnName = "Enabled";
				colvarEnabled.DataType = DbType.Boolean;
				colvarEnabled.MaxLength = 0;
				colvarEnabled.AutoIncrement = false;
				colvarEnabled.IsNullable = false;
				colvarEnabled.IsPrimaryKey = false;
				colvarEnabled.IsForeignKey = false;
				colvarEnabled.IsReadOnly = false;
				
						colvarEnabled.DefaultSetting = @"((0))";
				colvarEnabled.ForeignKeyTableName = "";
				schema.Columns.Add(colvarEnabled);
				
				TableSchema.TableColumn colvarLinkTarget = new TableSchema.TableColumn(schema);
				colvarLinkTarget.ColumnName = "LinkTarget";
				colvarLinkTarget.DataType = DbType.AnsiString;
				colvarLinkTarget.MaxLength = 255;
				colvarLinkTarget.AutoIncrement = false;
				colvarLinkTarget.IsNullable = true;
				colvarLinkTarget.IsPrimaryKey = false;
				colvarLinkTarget.IsForeignKey = false;
				colvarLinkTarget.IsReadOnly = false;
				colvarLinkTarget.DefaultSetting = @"";
				colvarLinkTarget.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLinkTarget);
				
				TableSchema.TableColumn colvarHeaderImage = new TableSchema.TableColumn(schema);
				colvarHeaderImage.ColumnName = "HeaderImage";
				colvarHeaderImage.DataType = DbType.AnsiString;
				colvarHeaderImage.MaxLength = 255;
				colvarHeaderImage.AutoIncrement = false;
				colvarHeaderImage.IsNullable = true;
				colvarHeaderImage.IsPrimaryKey = false;
				colvarHeaderImage.IsForeignKey = false;
				colvarHeaderImage.IsReadOnly = false;
				colvarHeaderImage.DefaultSetting = @"";
				colvarHeaderImage.ForeignKeyTableName = "";
				schema.Columns.Add(colvarHeaderImage);
				
				TableSchema.TableColumn colvarFooterImage = new TableSchema.TableColumn(schema);
				colvarFooterImage.ColumnName = "FooterImage";
				colvarFooterImage.DataType = DbType.AnsiString;
				colvarFooterImage.MaxLength = 255;
				colvarFooterImage.AutoIncrement = false;
				colvarFooterImage.IsNullable = true;
				colvarFooterImage.IsPrimaryKey = false;
				colvarFooterImage.IsForeignKey = false;
				colvarFooterImage.IsReadOnly = false;
				colvarFooterImage.DefaultSetting = @"";
				colvarFooterImage.ForeignKeyTableName = "";
				schema.Columns.Add(colvarFooterImage);
				
				TableSchema.TableColumn colvarCreatedBy = new TableSchema.TableColumn(schema);
				colvarCreatedBy.ColumnName = "CreatedBy";
				colvarCreatedBy.DataType = DbType.String;
				colvarCreatedBy.MaxLength = 50;
				colvarCreatedBy.AutoIncrement = false;
				colvarCreatedBy.IsNullable = false;
				colvarCreatedBy.IsPrimaryKey = false;
				colvarCreatedBy.IsForeignKey = false;
				colvarCreatedBy.IsReadOnly = false;
				colvarCreatedBy.DefaultSetting = @"";
				colvarCreatedBy.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCreatedBy);
				
				TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
				colvarCreatedOn.ColumnName = "CreatedOn";
				colvarCreatedOn.DataType = DbType.DateTime;
				colvarCreatedOn.MaxLength = 0;
				colvarCreatedOn.AutoIncrement = false;
				colvarCreatedOn.IsNullable = false;
				colvarCreatedOn.IsPrimaryKey = false;
				colvarCreatedOn.IsForeignKey = false;
				colvarCreatedOn.IsReadOnly = false;
				colvarCreatedOn.DefaultSetting = @"";
				colvarCreatedOn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCreatedOn);
				
				TableSchema.TableColumn colvarModifiedBy = new TableSchema.TableColumn(schema);
				colvarModifiedBy.ColumnName = "ModifiedBy";
				colvarModifiedBy.DataType = DbType.String;
				colvarModifiedBy.MaxLength = 50;
				colvarModifiedBy.AutoIncrement = false;
				colvarModifiedBy.IsNullable = true;
				colvarModifiedBy.IsPrimaryKey = false;
				colvarModifiedBy.IsForeignKey = false;
				colvarModifiedBy.IsReadOnly = false;
				colvarModifiedBy.DefaultSetting = @"";
				colvarModifiedBy.ForeignKeyTableName = "";
				schema.Columns.Add(colvarModifiedBy);
				
				TableSchema.TableColumn colvarModifiedOn = new TableSchema.TableColumn(schema);
				colvarModifiedOn.ColumnName = "ModifiedOn";
				colvarModifiedOn.DataType = DbType.DateTime;
				colvarModifiedOn.MaxLength = 0;
				colvarModifiedOn.AutoIncrement = false;
				colvarModifiedOn.IsNullable = true;
				colvarModifiedOn.IsPrimaryKey = false;
				colvarModifiedOn.IsForeignKey = false;
				colvarModifiedOn.IsReadOnly = false;
				colvarModifiedOn.DefaultSetting = @"";
				colvarModifiedOn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarModifiedOn);
				
				BaseSchema = schema;
				//add this schema to the provider
				//so we can query it later
				DataService.Providers["ImpactProvider"].AddSchema("impact_Pages",schema);
			}
		}
		#endregion
		
		#region Props
		  
		[XmlAttribute("PageId")]
		[Bindable(true)]
		public int PageId 
		{
			get { return GetColumnValue<int>(Columns.PageId); }
			set { SetColumnValue(Columns.PageId, value); }
		}
		  
		[XmlAttribute("Type")]
		[Bindable(true)]
		public int Type 
		{
			get { return GetColumnValue<int>(Columns.Type); }
			set { SetColumnValue(Columns.Type, value); }
		}
		  
		[XmlAttribute("PageKey")]
		[Bindable(true)]
		public string PageKey 
		{
			get { return GetColumnValue<string>(Columns.PageKey); }
			set { SetColumnValue(Columns.PageKey, value); }
		}
		  
		[XmlAttribute("Caption")]
		[Bindable(true)]
		public string Caption 
		{
			get { return GetColumnValue<string>(Columns.Caption); }
			set { SetColumnValue(Columns.Caption, value); }
		}
		  
		[XmlAttribute("ParentPageId")]
		[Bindable(true)]
		public int? ParentPageId 
		{
			get { return GetColumnValue<int?>(Columns.ParentPageId); }
			set { SetColumnValue(Columns.ParentPageId, value); }
		}
		  
		[XmlAttribute("TemplateId")]
		[Bindable(true)]
		public int? TemplateId 
		{
			get { return GetColumnValue<int?>(Columns.TemplateId); }
			set { SetColumnValue(Columns.TemplateId, value); }
		}
		  
		[XmlAttribute("Title")]
		[Bindable(true)]
		public string Title 
		{
			get { return GetColumnValue<string>(Columns.Title); }
			set { SetColumnValue(Columns.Title, value); }
		}
		  
		[XmlAttribute("Body")]
		[Bindable(true)]
		public string Body 
		{
			get { return GetColumnValue<string>(Columns.Body); }
			set { SetColumnValue(Columns.Body, value); }
		}
		  
		[XmlAttribute("FooterText")]
		[Bindable(true)]
		public string FooterText 
		{
			get { return GetColumnValue<string>(Columns.FooterText); }
			set { SetColumnValue(Columns.FooterText, value); }
		}
		  
		[XmlAttribute("Sequence")]
		[Bindable(true)]
		public int Sequence 
		{
			get { return GetColumnValue<int>(Columns.Sequence); }
			set { SetColumnValue(Columns.Sequence, value); }
		}
		  
		[XmlAttribute("Enabled")]
		[Bindable(true)]
		public bool Enabled 
		{
			get { return GetColumnValue<bool>(Columns.Enabled); }
			set { SetColumnValue(Columns.Enabled, value); }
		}
		  
		[XmlAttribute("LinkTarget")]
		[Bindable(true)]
		public string LinkTarget 
		{
			get { return GetColumnValue<string>(Columns.LinkTarget); }
			set { SetColumnValue(Columns.LinkTarget, value); }
		}
		  
		[XmlAttribute("HeaderImage")]
		[Bindable(true)]
		public string HeaderImage 
		{
			get { return GetColumnValue<string>(Columns.HeaderImage); }
			set { SetColumnValue(Columns.HeaderImage, value); }
		}
		  
		[XmlAttribute("FooterImage")]
		[Bindable(true)]
		public string FooterImage 
		{
			get { return GetColumnValue<string>(Columns.FooterImage); }
			set { SetColumnValue(Columns.FooterImage, value); }
		}
		  
		[XmlAttribute("CreatedBy")]
		[Bindable(true)]
		public string CreatedBy 
		{
			get { return GetColumnValue<string>(Columns.CreatedBy); }
			set { SetColumnValue(Columns.CreatedBy, value); }
		}
		  
		[XmlAttribute("CreatedOn")]
		[Bindable(true)]
		public DateTime CreatedOn 
		{
			get { return GetColumnValue<DateTime>(Columns.CreatedOn); }
			set { SetColumnValue(Columns.CreatedOn, value); }
		}
		  
		[XmlAttribute("ModifiedBy")]
		[Bindable(true)]
		public string ModifiedBy 
		{
			get { return GetColumnValue<string>(Columns.ModifiedBy); }
			set { SetColumnValue(Columns.ModifiedBy, value); }
		}
		  
		[XmlAttribute("ModifiedOn")]
		[Bindable(true)]
		public DateTime? ModifiedOn 
		{
			get { return GetColumnValue<DateTime?>(Columns.ModifiedOn); }
			set { SetColumnValue(Columns.ModifiedOn, value); }
		}
		
		#endregion
		
		
		#region PrimaryKey Methods		
		
        protected override void SetPrimaryKey(object oValue)
        {
            base.SetPrimaryKey(oValue);
            
            SetPKValues();
        }
        
				
		private Impact.Model.Objects.PagePluginCollection colPagePlugins;
		public Impact.Model.Objects.PagePluginCollection PagePlugins
		{
			get
			{
				if(colPagePlugins == null)
				{
					colPagePlugins = new Impact.Model.Objects.PagePluginCollection().Where(PagePlugin.Columns.PageId, PageId).Load();
					colPagePlugins.ListChanged += new ListChangedEventHandler(colPagePlugins_ListChanged);
				}
				return colPagePlugins;			
			}
			set 
			{ 
					colPagePlugins = value; 
					colPagePlugins.ListChanged += new ListChangedEventHandler(colPagePlugins_ListChanged);
			}
		}
		
		void colPagePlugins_ListChanged(object sender, ListChangedEventArgs e)
		{
		    if (e.ListChangedType == ListChangedType.ItemAdded)
		    {
		        // Set foreign key value
		        colPagePlugins[e.NewIndex].PageId = PageId;
		    }
		}
		
		#endregion
		
			
		
		#region ForeignKey Properties
		
		/// <summary>
		/// Returns a PageType ActiveRecord object related to this ImpactPage
		/// 
		/// </summary>
		public Impact.Model.Objects.PageType PageType
		{
			get { return Impact.Model.Objects.PageType.FetchByID(this.Type); }
			set { SetColumnValue("Type", value.TypeId); }
		}
		
		
		/// <summary>
		/// Returns a Template ActiveRecord object related to this ImpactPage
		/// 
		/// </summary>
		public Impact.Model.Objects.Template Template
		{
			get { return Impact.Model.Objects.Template.FetchByID(this.TemplateId); }
			set { SetColumnValue("TemplateId", value.TemplateID); }
		}
		
		
		#endregion
		
		
		
		//no ManyToMany tables defined (0)
		
        
        
		#region ObjectDataSource support
		
		
		/// <summary>
		/// Inserts a record, can be used with the Object Data Source
		/// </summary>
		public static void Insert(int varType,string varPageKey,string varCaption,int? varParentPageId,int? varTemplateId,string varTitle,string varBody,string varFooterText,int varSequence,bool varEnabled,string varLinkTarget,string varHeaderImage,string varFooterImage,string varCreatedBy,DateTime varCreatedOn,string varModifiedBy,DateTime? varModifiedOn)
		{
			ImpactPage item = new ImpactPage();
			
			item.Type = varType;
			
			item.PageKey = varPageKey;
			
			item.Caption = varCaption;
			
			item.ParentPageId = varParentPageId;
			
			item.TemplateId = varTemplateId;
			
			item.Title = varTitle;
			
			item.Body = varBody;
			
			item.FooterText = varFooterText;
			
			item.Sequence = varSequence;
			
			item.Enabled = varEnabled;
			
			item.LinkTarget = varLinkTarget;
			
			item.HeaderImage = varHeaderImage;
			
			item.FooterImage = varFooterImage;
			
			item.CreatedBy = varCreatedBy;
			
			item.CreatedOn = varCreatedOn;
			
			item.ModifiedBy = varModifiedBy;
			
			item.ModifiedOn = varModifiedOn;
			
		
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		
		/// <summary>
		/// Updates a record, can be used with the Object Data Source
		/// </summary>
		public static void Update(int varPageId,int varType,string varPageKey,string varCaption,int? varParentPageId,int? varTemplateId,string varTitle,string varBody,string varFooterText,int varSequence,bool varEnabled,string varLinkTarget,string varHeaderImage,string varFooterImage,string varCreatedBy,DateTime varCreatedOn,string varModifiedBy,DateTime? varModifiedOn)
		{
			ImpactPage item = new ImpactPage();
			
				item.PageId = varPageId;
			
				item.Type = varType;
			
				item.PageKey = varPageKey;
			
				item.Caption = varCaption;
			
				item.ParentPageId = varParentPageId;
			
				item.TemplateId = varTemplateId;
			
				item.Title = varTitle;
			
				item.Body = varBody;
			
				item.FooterText = varFooterText;
			
				item.Sequence = varSequence;
			
				item.Enabled = varEnabled;
			
				item.LinkTarget = varLinkTarget;
			
				item.HeaderImage = varHeaderImage;
			
				item.FooterImage = varFooterImage;
			
				item.CreatedBy = varCreatedBy;
			
				item.CreatedOn = varCreatedOn;
			
				item.ModifiedBy = varModifiedBy;
			
				item.ModifiedOn = varModifiedOn;
			
			item.IsNew = false;
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		#endregion
        
        
        
        #region Typed Columns
        
        
        public static TableSchema.TableColumn PageIdColumn
        {
            get { return Schema.Columns[0]; }
        }
        
        
        
        public static TableSchema.TableColumn TypeColumn
        {
            get { return Schema.Columns[1]; }
        }
        
        
        
        public static TableSchema.TableColumn PageKeyColumn
        {
            get { return Schema.Columns[2]; }
        }
        
        
        
        public static TableSchema.TableColumn CaptionColumn
        {
            get { return Schema.Columns[3]; }
        }
        
        
        
        public static TableSchema.TableColumn ParentPageIdColumn
        {
            get { return Schema.Columns[4]; }
        }
        
        
        
        public static TableSchema.TableColumn TemplateIdColumn
        {
            get { return Schema.Columns[5]; }
        }
        
        
        
        public static TableSchema.TableColumn TitleColumn
        {
            get { return Schema.Columns[6]; }
        }
        
        
        
        public static TableSchema.TableColumn BodyColumn
        {
            get { return Schema.Columns[7]; }
        }
        
        
        
        public static TableSchema.TableColumn FooterTextColumn
        {
            get { return Schema.Columns[8]; }
        }
        
        
        
        public static TableSchema.TableColumn SequenceColumn
        {
            get { return Schema.Columns[9]; }
        }
        
        
        
        public static TableSchema.TableColumn EnabledColumn
        {
            get { return Schema.Columns[10]; }
        }
        
        
        
        public static TableSchema.TableColumn LinkTargetColumn
        {
            get { return Schema.Columns[11]; }
        }
        
        
        
        public static TableSchema.TableColumn HeaderImageColumn
        {
            get { return Schema.Columns[12]; }
        }
        
        
        
        public static TableSchema.TableColumn FooterImageColumn
        {
            get { return Schema.Columns[13]; }
        }
        
        
        
        public static TableSchema.TableColumn CreatedByColumn
        {
            get { return Schema.Columns[14]; }
        }
        
        
        
        public static TableSchema.TableColumn CreatedOnColumn
        {
            get { return Schema.Columns[15]; }
        }
        
        
        
        public static TableSchema.TableColumn ModifiedByColumn
        {
            get { return Schema.Columns[16]; }
        }
        
        
        
        public static TableSchema.TableColumn ModifiedOnColumn
        {
            get { return Schema.Columns[17]; }
        }
        
        
        
        #endregion
		#region Columns Struct
		public struct Columns
		{
			 public static string PageId = @"PageId";
			 public static string Type = @"Type";
			 public static string PageKey = @"PageKey";
			 public static string Caption = @"Caption";
			 public static string ParentPageId = @"ParentPageId";
			 public static string TemplateId = @"TemplateId";
			 public static string Title = @"Title";
			 public static string Body = @"Body";
			 public static string FooterText = @"FooterText";
			 public static string Sequence = @"Sequence";
			 public static string Enabled = @"Enabled";
			 public static string LinkTarget = @"LinkTarget";
			 public static string HeaderImage = @"HeaderImage";
			 public static string FooterImage = @"FooterImage";
			 public static string CreatedBy = @"CreatedBy";
			 public static string CreatedOn = @"CreatedOn";
			 public static string ModifiedBy = @"ModifiedBy";
			 public static string ModifiedOn = @"ModifiedOn";
						
		}
		#endregion
		
		#region Update PK Collections
		
        public void SetPKValues()
        {
                if (colPagePlugins != null)
                {
                    foreach (Impact.Model.Objects.PagePlugin item in colPagePlugins)
                    {
                        if (item.PageId != PageId)
                        {
                            item.PageId = PageId;
                        }
                    }
               }
		}
        #endregion
    
        #region Deep Save
		
        public void DeepSave()
        {
            Save();
            
                if (colPagePlugins != null)
                {
                    colPagePlugins.SaveAll();
               }
		}
        #endregion
	}
}
